package walls.controller;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import walls.entity.R;
import walls.utils.JwtTokenUtil;


@RestController
@RequestMapping("/user")
@Tag(name = "用户管理", description = "用户相关操作接口")
public class UserController {
    @Autowired
    JwtTokenUtil jwtTokenUtil;

    @Operation(summary = "登录接口", description = "登录接口")
    @PostMapping("/login")
    public walls.entity.R login() {
        String token = jwtTokenUtil.generateToken(1L, "admin", "ROLE_ADMIN");
        return R.ok(token);
    }

    @GetMapping("/test")
    public R test() {
        return R.ok();
    }
}
